#region File Description
//-----------------------------------------------------------------------------
// OptionsMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using Microsoft.Xna.Framework;
#endregion

namespace TankWars
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class OptionsMenuScreen : MenuScreen
    {
        #region Fields

        MenuEntry FullScreenMenuEntry;
        //MenuEntry soundsMenuEntry;
        MenuEntry controllerHelpMenuEntry;
        MenuEntry backMenuEntry;

        //static bool soundsOn = true;

        #endregion

        #region Initialization


        /// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen() : base("Game Options")
        {
            // Create our menu entries.
            FullScreenMenuEntry = new MenuEntry(string.Empty);
            //soundsMenuEntry = new MenuEntry(string.Empty);            

            SetMenuEntryText();

            controllerHelpMenuEntry = new MenuEntry("Controls");
            backMenuEntry = new MenuEntry("Back to Main Menu");

            // Hook up menu event handlers.
            FullScreenMenuEntry.Selected += ResolutionMenuEntrySelected;
            //soundsMenuEntry.Selected += soundsMenuEntrySelected;
            controllerHelpMenuEntry.Selected += ControllerHelpMenuEntrySelected;
            backMenuEntry.Selected += OnCancel;
            
            // Add entries to the menu.
            MenuEntries.Add(FullScreenMenuEntry);
            //MenuEntries.Add(soundsMenuEntry);
            MenuEntries.Add(controllerHelpMenuEntry);
            MenuEntries.Add(backMenuEntry);
        }


        /// <summary>
        /// Fills in the latest values for the options screen menu text.
        /// </summary>
        void SetMenuEntryText()
        {
            FullScreenMenuEntry.Text = "Window Mode: " + (FullScreenOn ? "Full Screen" : "Window");
            //soundsMenuEntry.Text = "Sounds: " + (soundsOn ? "on" : "off");
        }


        #endregion

        #region Handle Input


        /// <summary>
        /// Event handler for when the Resolution menu entry is selected.
        /// </summary>
        void ResolutionMenuEntrySelected(object sender, EventArgs e)
        {
            //this.ScreenManager.TankWarsGame.Graphics.ToggleFullScreen();

            ScreenManager.TankWarsGame.Graphics.ToggleFullScreen();

            FullScreenOn = !FullScreenOn;   // toggle value

            SetMenuEntryText();
        }

/*
        /// <summary>
        /// Event handler for when the Sounds menu entry is selected.
        /// </summary>
        void soundsMenuEntrySelected(object sender, EventArgs e)
        {
            soundsOn = !soundsOn;

            SetMenuEntryText();
        }
 */


        /// <summary>
        /// Event handler for selection of the controller help menu entry
        /// </summary>
        void ControllerHelpMenuEntrySelected(object sender, EventArgs e)
        {
            ScreenManager.AddScreen(new PictureScreen());
        }

        #endregion
    }
}
